Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update CLI to migrate guest authors #3664

Closed
wants to merge 3 commits into from

Conversation

leogermani
Copy link
Contributor

@leogermani leogermani commented Jan 10, 2025

Closed in favor of #3724

All Submissions:

Changes proposed in this Pull Request:

This PR changes the logic of the guest author migration script.

Basically, the script was checking if a guest user already existed as a regular WP user based on the user_login. I'm changing that to check for the user_nicename.

In a regular situation, the nicename will usually be the same thing as the login, but there are cases where they can be different. One of them is when you migrated users from another system and treated these fields in a different way in the database.

CAP uses the $user->user_nicename to create and match the author term, and that's why this is the field we should look at.

How to test the changes in this Pull Request:

  1. Create a few guest authors and assign posts to them.
  2. Run the script and make sure the guest contributors users are created and the posts are correctly assigned.
  3. Create a guest author and make sure there is a wp user that has its nicename with the same value of the GA's login
  4. Run the script and make sure no new WP user is created, and the posts that were assigned to that GA is assigned to this WP user

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@leogermani leogermani added the [Status] Needs Review The issue or pull request needs to be reviewed label Feb 4, 2025
@leogermani leogermani self-assigned this Feb 4, 2025
@leogermani leogermani marked this pull request as ready for review February 4, 2025 20:58
@leogermani leogermani requested a review from a team as a code owner February 4, 2025 20:58
@leogermani leogermani closed this Feb 4, 2025
@leogermani leogermani deleted the update/migrate-guest-authors-cli branch February 4, 2025 21:02
@leogermani
Copy link
Contributor Author

Closed in favor of #3724

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Needs Review The issue or pull request needs to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant